import { createRouter, createWebHashHistory } from 'vue-router'
import Layout from '../views/layout/Layout.vue'
// import useUserStore from '@/store/modules/user'

export const constantRoutes = [
    {
        path: '/login',
        name: 'login',
        level: null,
        component: ()=>import('@/views/Login.vue'),
        meta: {
            requiresAuth: false,
            icon: 'login',
            title: '登陆'
        },
        hidden: true
    },
    {
        path: '/',
        component: Layout,
        level: 1,
        index: '1',
        hidden: false,
        redirect: '/home',
        meta: { title: '一级菜单', icon: 'Folder'},
        name: 'home',
        children: [
            {
                path: '/home',
                name: 'home',
                level: 2,
                index: '1-1',
                component: () => import('@/views/Home.vue'),
                meta: { title: '首页', icon: 'HomeFilled' },
                hidden: false,
                requiresAuth: true
            }
        ]
    },
    {
        path: '/examManagement',
        name: 'examManagement',
        redirect: '/examManagement/examCategories',
        level: 1,
        index: '2',
        component: Layout,
        meta: {
            requiresAuth: true,
            icon: 'Folder',
            title: '面试题管理'
        },
        hidden: false,
        children: [
            {
                path: '/examManagement/examCategories',
                name: 'examCategories',
                level: 2,
                index: '2-1',
                component: ()=>import('@/views/examManagement/examCategories/index.vue'),
                meta: {
                    requiresAuth: true,
                    icon: 'Document',
                    title: '面试题类目'
                },
                hidden: false
            },
            {
                path: '/examManagement/examList',
                name: 'examList',
                level: 2,
                index: '2-2',
                component: ()=>import('@/views/examManagement/examList/index.vue'),
                meta: {
                    requiresAuth: true,
                    icon: 'Document',
                    title: '面试题列表'
                },
                hidden: false
            }
        ]
    },
    { path: '/404', 
      component: () => import('@/views/404.vue'), 
      hidden: true,
      children: [],
      level: null,
      hidden: true
    }
]

export const dynamicRoutes = []

const router = createRouter({
    history: createWebHashHistory(),
    routes: constantRoutes
})
export default router